/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package model;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author km
 */
@Entity
@Table(name = "CHECK_CARD")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CheckCard.findAll", query = "SELECT c FROM CheckCard c"),
    @NamedQuery(name = "CheckCard.findByCheckCardId", query = "SELECT c FROM CheckCard c WHERE c.checkCardId = :checkCardId"),
    @NamedQuery(name = "CheckCard.findByAvailable", query = "SELECT c FROM CheckCard c WHERE c.available = :available"),
    @NamedQuery(name = "CheckCard.findByDateWon", query = "SELECT c FROM CheckCard c WHERE c.dateWon = :dateWon")})
public class CheckCard implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "CHECK_CARD_ID")
    private Integer checkCardId;
    @Basic(optional = false)
    @Column(name = "AVAILABLE")
    private Serializable available;
    @Basic(optional = false)
    @Column(name = "DATE_WON")
    @Temporal(TemporalType.DATE)
    private Date dateWon;
    @JoinColumn(name = "CUSTOMER", referencedColumnName = "CUSTOMER_ID")
    @ManyToOne(optional = false)
    private Customer customer;

    public CheckCard() {
    }

    public CheckCard(Integer checkCardId) {
        this.checkCardId = checkCardId;
    }

    public CheckCard(Integer checkCardId, Serializable available, Date dateWon) {
        this.checkCardId = checkCardId;
        this.available = available;
        this.dateWon = dateWon;
    }

    public Integer getCheckCardId() {
        return checkCardId;
    }

    public void setCheckCardId(Integer checkCardId) {
        this.checkCardId = checkCardId;
    }

    public Serializable getAvailable() {
        return available;
    }

    public void setAvailable(Serializable available) {
        this.available = available;
    }

    public Date getDateWon() {
        return dateWon;
    }

    public void setDateWon(Date dateWon) {
        this.dateWon = dateWon;
    }

    public Customer getCustomer() {
        return customer;
    }

    public void setCustomer(Customer customer) {
        this.customer = customer;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (checkCardId != null ? checkCardId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CheckCard)) {
            return false;
        }
        CheckCard other = (CheckCard) object;
        if ((this.checkCardId == null && other.checkCardId != null) || (this.checkCardId != null && !this.checkCardId.equals(other.checkCardId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.CheckCard[ checkCardId=" + checkCardId + " ]";
    }
    
}
